<html>
<head>
<title>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css" />
<script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"> </script>
<script type="text/javascript" src="../../ext/ext-all.js">  </script>
<script type="text/javascript"src="../../ext/source/locale/ext-lang-zh_CN.js"></script>
<body onload="fload()">
<script>

function fload()
{


	var info=window.dialogArguments;
	var myfieldLabel = info.fieldLabel ? info.fieldLabel : '';
	window.document.title=info.winTitle ? info.winTitle : myfieldLabel;
//	treeDialogWin.setTitle(info.winTitle ? info.winTitle : myfieldLabel);
	var treeDialoguxTree = new Ext.tree.TreePanel({
		autoScroll : true,
		height : 500,
		width:document.body.clientWidth,
		animate : false,
		useArrows : true,
		autoDestroy : true,
		dataUrl : '../../../relation.do?action=relationDataList',
		root : {nodeType : 'async',id : '0',text:(info.rootText? info.rootText: myfieldLabel)},
		renderTo:'treediv',
		tbar : [{
					xtype : 'combo',
					width : 60,
					displayField : 'field1',
					valueField : 'field2',
					hiddenName : 'field2',
					editable : false,
					mode : "local",
					value : "name",
					store : new Ext.data.SimpleStore({
								fields : ['field1', 'field2'],
								data : [['名称', 'name'], ['代码', 'code']]
							}),
					mode : 'local',
					triggerAction : 'all'
				}, {
					xtype : 'textfield',
					name : 'fdcName',
					emptyText : '请输入过滤条件...'

				}]
	});

	var loader = treeDialoguxTree.getLoader();
	if (info.dataParams) {

		for (var i = 0; i < info.dataParams.length; i++) {

			loader.baseParams[info.dataParams[i].name] = info.dataParams[i].value;
		}

	}
	loader.baseParams['elementcode'] = info.elementcode;
	loader.baseParams['byElementcode'] = info.byElementcode;
	loader.baseParams['mainId'] = info.tmpMainId ? info.tmpMainId : info.mainId;
	treeDialoguxTree.root.reload(function(node) {
		if (node.childNodes.length <= 0) {
			Ext.MessageBox.show({
						title : '没有可选择项',
						width : 160,
						msg : "没有可选择项",
						buttons : Ext.Msg.OK,
						icon : Ext.MessageBox.INFO,
						fn:function(){window.close();}
					});
					
				
		}
		

	});
	info.win=window;
	treeDialoguxTree.on("click", info.onClickFunction, info);
	
}

function fkeydown()
{
	if(event.keyCode==27){
		event.returnValue = null;
		window.returnValue = null;
		window.close();
	}
}

document.onkeydown=fkeydown;
</script>
<div id="treediv"></div>
</body>
</html>